package main.od;

import java.util.Arrays;
import java.util.Scanner;

public class FindTreasure {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = Arrays.stream(sc.nextLine().split(","))
                .mapToInt(Integer::parseInt).toArray();
        int left = 0;
        int right = 0;
        boolean flag = false;
        for (int temp : arr){
            right += temp;
        }
        for (int i = 0;i < arr.length;i++){
            if (0 != i){
                left += arr[i - 1];
            }
            right -= arr[i];
            if (left == right){
                System.out.println(i);
                flag = true;
                break;
            }
        }
        if (!flag){
            System.out.println(-1);
        }
    }
}
